import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.message.BasicNameValuePair;

import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;

public class HttpClientPostFormParam {
    public static void main(String[] args) throws IOException {

        List<NameValuePair> parameters = new ArrayList<NameValuePair>();
        NameValuePair nameValuePair = new BasicNameValuePair("p1","abc");
        parameters.add(nameValuePair);
        UrlEncodedFormEntity urlEncodedFormEntity = new UrlEncodedFormEntity(parameters);
        urlEncodedFormEntity.setContentType("application/x-www-form-urlencode");
        InputStream content = urlEncodedFormEntity.getContent();
        HttpPost httpPost = new HttpPost("abc");
        httpPost.setEntity(urlEncodedFormEntity);

    }
}
